#include<stdio.h>

int dx[] = { 0,-1,0,1 };
int dy[] = { -1,0,1,0 };

int main()
{
    int n;    scanf("%d", &n);
    int a[15][15] = { 0 };
    int t = n * n;
    int x, y, i, j;
    x = y = n, i = j = 0;
    int tx, ty;
    while (t)
    {
        a[x][y] = t;
        tx = x + dx[i], ty = y + dy[i];
        if (tx > n || tx<1 || ty>n || ty < 1 || a[tx][ty] != 0)
            i = (i + 1) % 4, j = (j + 1) % 4;
        x += dx[i], y += dy[i];
        t--;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
            printf("%6d", a[i][j]);
        printf("\n");
    }
    return 0;
}